<script type="text/javascript" src="{$smarty.const.LIB_DIR}js/ObjectBase.js"></script>
<script type="text/javascript" src="{$smarty.const.LIB_DIR}js/Seat.js"></script>
<script type="text/javascript" src="{$smarty.const.LIB_DIR}js/CustomObject.js"></script>
<script type="text/javascript" src="{$smarty.const.LIB_DIR}js/RoundTable.js"></script>

<script type="text/javascript" src="{$smarty.const.LIB_DIR}js/ReservationManager.js"></script>

<div style="width: 1300px">
    <div style="float: left; width: 200px;">
        <div style="margin: auto; width: 160px;">
            <div id="control" class="ui-widget-content ui-corner-all">
                <h3 class="ui-widget-header" style="margin-top: 0; margin-bottom: 0; text-align: center;">Voľné rezervácie</h3>
                <h2 style="text-align: center; margin: 20px; font-size: 2em;"><span id="freeReservationCount">0</span></h2>
            </div>
            <button id="btnMagic" class="button">Medžik</button>
            <button id="btnOrder" class="button">Objednaj</button>
            <div id="legend" class="ui-widget-content ui-corner-all">
                <h3 class="ui-widget-header" style="margin-top: 0; margin-bottom: 0; text-align: center;"> Legenda</h3>
                <div style="font-size: 0.7em;">
                {include file="`$smarty.const.TEMPLATE_DIR`snippets/tut_miesta.tpl"}
                </div>
            </div>
            <button class="button" style="width: 100%" onclick="$('#help').dialog('open');">Pomoc</button>
            <button class="button" style="width: 100%" onclick="window.location.href='home?action=logout'">Odhlásiť sa</button>
        </div>
    </div>
    <div id="target" style=" float: left; width: 1100px; height: 1100px; background: #90ee90; position: relative;">
    </div>
</div>



<div id="help">
    {include file="`$smarty.const.TEMPLATE_DIR`snippets/tut_miesta_more.tpl"}
</div>

{literal}
<script type="text/javascript">
    var manager = new ReservationManager({
        target: "#target",
        {/literal}
        reservedSeats: {$data.reservedSeats},
        userSeats: {$data.userSeats},
        orderedSeats: {$data.userOrderedSeats},
        reservationsPerUser: {$data.maxOrders}
        {literal}
    });

    $("#help").dialog({
        autoOpen: false,
        title: "Nápoveda",
        width: 800
    });

    $("#btnMagic").bind("click", function(){
        manager.magic();
    });

    $("#btnOrder").bind("click", function(){
        manager.order();
    });

    $(".button").button();

    $(function(){
        manager.load();
    });
</script>
{/literal}

{include file="`$smarty.const.TEMPLATE_DIR`snippets/plan_overlay.tpl" open=$data.open}
